﻿<html>
<head>
<title>MÁY IN</title>
</head>
<body bgcolor="#30D5C8">
<form method="POST" action="">
<center>
<marquee behavior=altermate><h1><font color="blue"><i><b>Welcome</b></i></font></h1></marquee>
 <h1><font color=#001070> MÁY IN</font></h1>

			Trọng lượng:
			<INPUT  TYPE= "text" NAME ="trong_luong" SIZE="10"><br>
			Năm SX: 
			<INPUT  TYPE= "text" NAME ="nam_san_xuat" SIZE="10"><br>
			Hãng SX: 
			<INPUT  TYPE= "text" NAME ="hang_san_xuat" SIZE="10"><br>
			Số kim:
			<INPUT  TYPE= "text" NAME ="so_kim" SIZE="10"><br>
			Tốc độ in kim:
			<INPUT  TYPE= "text" NAME ="toc_do_in" SIZE="10"><br>
			Độ phân giải:
			<INPUT  TYPE= "text" NAME ="do_phan_giai" SIZE="10"><br>
			Tốc độ in laser:
			<INPUT  TYPE= "text" NAME ="toc_do_in_laser" SIZE="10"><br>
	
			<input type="submit" name="text" value="Xem">
			<input type="reset" name="text" value= " Xóa ">

<?php
		if(isset($_POST["trong_luong"])&&isset($_POST["nam_san_xuat"])&&isset($_POST["hang_san_xuat"])&&isset($_POST["so_kim"])&&isset($_POST["toc_do_in"])&&isset($_POST["do_phan_giai"])&&isset($_POST["toc_do_in_laser"]))
		{
			$trong_luong=$_POST["trong_luong"];
			$nam_san_xuat=$_POST["nam_san_xuat"];
			$hang_san_xuat=$_POST["hang_san_xuat"];
			$so_kim=(int)$_POST["so_kim"];
			$toc_do_in=(int)$_POST["toc_do_in"];
			$do_phan_giai=(int)$_POST["do_phan_giai"];
			$toc_do_in_laser=(int)$_POST["toc_do_in_laser"];
			$tl=is_numeric($trong_luong);
			$nam=is_numeric($nam_san_xuat);
			$kim=is_numeric($so_kim);
			$tocdo=is_numeric($toc_do_in);
			$phangiai=is_numeric($do_phan_giai);
			$tocdo2=is_numeric($toc_do_in_laser);
			if($trong_luong==null||$nam_san_xuat==null||$hang_san_xuat==null||$so_kim==null||$toc_do_in==null||$do_phan_giai==null||$toc_do_in_laser==null||$tl!=1||strlen($nam_san_xuat)!=4||$trong_luong<=0||$nam_san_xuat<=0||$so_kim<=0||$toc_do_in<=0||$do_phan_giai<=0||$toc_do_in_laser<=0)
			{
				echo"<h1><b></b><br> Giá trị bạn nhập vào không đúng!</h1> ";
				return;
			}
			}
			else
			{
				Class mayin
				{
					public $trong_luong;
					public $nam_san_xuat;
					public $hang_san_xuat;
					function nhap($trong_luong,$nam_san_xuat,$hang_san_xuat)
					{
						$this->trong_luong=$trong_luong;
						$this->nam_san_xuat=$nam_san_xuat;
						$this->hang_san_xuat=$hang_san_xuat;
					}
					public function xuat()
					{
					echo "<br>Trọng lượng: ".$this->trong_luong;
					echo "<br>Năm SX: ".$this->nam_san_xuat;
					echo "<br>Hãng SX: ".$this->hang_san_xuat;
					}
				}
				Class mayinkim extends mayin
				{
					public $so_kim;
					public $toc_do_in;
					function nhap_may_in_kim($trong_luong,$nam_san_xuat,$hang_san_xuat,$so_kim,$toc_do_in)
					{
						$this->nhap($trong_luong,$nam_san_xuat,$hang_san_xuat);
						$this->so_kim=$so_kim;
						$this->toc_do_in=$toc_do_in;
					}
					public function xuat_may_in_kim()
					{
					  
							$this->xuat();
							echo "<br>Số kim: ".$this->so_kim;
							echo "<br>Tốc độ in: ".$this->toc_do_in;
						
					}

				}
				Class mayinlaser extends mayin
				{

					public $do_phan_giai;
					public $toc_do_in_laser;
					function nhap_may_in_laser($trong_luong,$nam_san_xuat,$hang_san_xuat,$do_phan_giai,$toc_do_in_laser)
					{
						$this->nhap($trong_luong,$nam_san_xuat,$hang_san_xuat);
						$this->do_phan_giai=$do_phan_giai;
						$this->toc_do_in_laser=$toc_do_in_laser;
					}
					public function xuat_may_in_laser()
					{

							$this->xuat();
							echo "<br>Độ phân giải: ".$this->do_phan_giai;
							echo "<br>Tốc độ in: ".$this->toc_do_in_laser;
					}
				}
			echo "<br><h1><b>MÁY IN KIM</b></h1>";
			$may_in_kim= new mayinkim();
			$may_in_kim->nhap_may_in_kim($trong_luong,$nam_san_xuat,$hang_san_xuat,$so_kim,$toc_do_in);
			$may_in_kim->xuat_may_in_kim();
			echo "<br><h1><br><b>MÁY IN LASER</b></h1>";
			$may_in_laser= new mayinlaser();
			$may_in_laser->nhap_may_in_laser($trong_luong,$nam_san_xuat,$hang_san_xuat,$do_phan_giai,$toc_do_in_laser);
			$may_in_laser->xuat_may_in_laser();
			}
		
?>
</center>
</form>
</body>
</html>